/* $RCSFile: ADNDynMailmergetemplate.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynMailmergetemplate.cs $
 * $log$
 * Revision 19 2010/10/02 14:01:49  christian.surieux
 *   Corrected a bug in allmost everyADNDyn file for PrimaryFieldVualue
 * Revision 6 2010/08/06 19:56:33  christian.surieux
 *   Added Log to All cs files
 */

/* Copyrights Christian Surieux 2010 */
/* Class ADNDynMailmergetemplate */
/* Date 2010-01-06 16:08:23Z */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
    public class ADNDynMailmergetemplate : DynEntity
    {
        protected class Ftor: DFactor
        {
            public Ftor() : base(CrmStr.mailmergetemplate)
            {}

            public override Type DynType
            { get { return typeof(ADNDynMailmergetemplate); } }

            public override string DynTypename
            {   get{ return CrmStr.mailmergetemplate;}}

            public override DynEntity Build()
            {
                return new ADNDynMailmergetemplate();
            }
            public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
            {   return new ADNDynMailmergetemplate(w, dEntity, wproperties, null);}

            public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
            {   return new ADNDynMailmergetemplate(w, PrimaryFieldValue);}

            public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
            {   return new ADNDynMailmergetemplate(w,PrimaryKeyValue);}
        }

        static ADNDynMailmergetemplate(){new Ftor();} 


        public override bool HasOwningBusinessUnitProperty
        { get { return true; } }
        
        public ADNDynMailmergetemplate() : base() { }
        
        public ADNDynMailmergetemplate(CRMWrapperBase w,string PrimaryFieldValue)
            : base(w,CrmStr.mailmergetemplate)
        {
            if ( PrimaryFieldValue != string.Empty )
                name = PrimaryFieldValue;
        }
        
        public ADNDynMailmergetemplate(CRMWrapperBase w,Guid CrmId) : base(w,CrmStr.mailmergetemplate,CrmId) { }
        
        public ADNDynMailmergetemplate(CRMWrapperBase w,InternalDynamicEntity e) : base(w,CrmStr.mailmergetemplate,e,null,null) { }
        
        public ADNDynMailmergetemplate(CRMWrapperBase w,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(w,CrmStr.mailmergetemplate,e,prop,s) { }
        
        public ADNDynMailmergetemplate(ResetWrapperHandler fn,string PrimaryFieldValue)
            : base(fn,CrmStr.mailmergetemplate)
        {
            if ( PrimaryFieldValue != string.Empty )
                name = PrimaryFieldValue;
        }
        
        public ADNDynMailmergetemplate(ResetWrapperHandler fn,Guid CrmId) : base(fn,CrmStr.mailmergetemplate,CrmId) { }
        
        public ADNDynMailmergetemplate(ResetWrapperHandler fn,InternalDynamicEntity e) : base(fn,CrmStr.mailmergetemplate,e,null,null) { }
        
        public ADNDynMailmergetemplate(ResetWrapperHandler fn,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(fn,CrmStr.mailmergetemplate,e,prop,s) { }

        /* Properties */

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public Guid mailmergetemplateid
        {
            get
            { return KeyPropertyValue(CrmStr.mailmergetemplateid); }
            set
            { AddKeyProperty(CrmStr.mailmergetemplateid,value); }
        }

        protected override void SetCrmIdProperty(Guid crmId)
        {
            if ( !dicProperty.ContainsKey(CrmStr.mailmergetemplateid) || KeyPropertyValue(CrmStr.mailmergetemplateid) != crmId )
                mailmergetemplateid = crmId;
        }
        public override Guid PrimaryKeyGuidValue
        {
            get
            { return mailmergetemplateid; }
            set { mailmergetemplateid = value; }
        }
        
        public override string PrimaryFieldName
        {
            get
            { return CrmStr.name; }
            set
            {}
        }

        /// <summary>
        /// Value contained in the PrimaryField for the DynEntity or empty if no PrimaryField
        /// </summary>
        public override string PrimaryFieldStringValue
        {
            get
            {
                return name;
            }
            set
            {
                name =   value;
            }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public string body
        {
            get
            { return StringPropertyValue(CrmStr.body); }
            set
            { AddStringProperty(CrmStr.body,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public string defaultfilter
        {
            get
            { return StringPropertyValue(CrmStr.defaultfilter); }
            set
            { AddStringProperty(CrmStr.defaultfilter,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public string description
        {
            get
            { return StringPropertyValue(CrmStr.description); }
            set
            { AddStringProperty(CrmStr.description,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public int documentformat
        {
            get
            { return PicklistPropertyIntValue(CrmStr.documentformat); }
            set
            { AddPicklistProperty(CrmStr.documentformat,value); }
        }

        public string documentformatLabel
        {
            get
            { return PicklistPropertyLabelValue(CrmStr.documentformat); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public string filename
        {
            get
            { return StringPropertyValue(CrmStr.filename); }
            set
            { AddStringProperty(CrmStr.filename,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public int filesize
        {
            get
            { return NumberPropertyValue(CrmStr.filesize); }
            set
            { AddNumberProperty(CrmStr.filesize,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public bool ispersonal
        {
            get
            { return BooleanPropertyValue(CrmStr.ispersonal); }
            set
            { AddBooleanProperty(CrmStr.ispersonal,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public int languagecode
        {
            get
            { return NumberPropertyValue(CrmStr.languagecode); }
            set
            { AddNumberProperty(CrmStr.languagecode,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public int mailmergetype
        {
            get
            { return PicklistPropertyIntValue(CrmStr.mailmergetype); }
            set
            { AddPicklistProperty(CrmStr.mailmergetype,value); }
        }

        public string mailmergetypeLabel
        {
            get
            { return PicklistPropertyLabelValue(CrmStr.mailmergetype); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public string mimetype
        {
            get
            { return StringPropertyValue(CrmStr.mimetype); }
            set
            { AddStringProperty(CrmStr.mimetype,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public override string name
        {
            get
            { return StringPropertyValue(CrmStr.name); }
            set
            { AddStringProperty(CrmStr.name,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public Guid owningbusinessunit
        {
            get
            { return LookupPropertyValue(CrmStr.owningbusinessunit); }
            set
            { AddLookupProperty(CrmStr.owningbusinessunit,CrmStr.businessunit,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public Guid owninguser
        {
            get
            { return LookupPropertyValue(CrmStr.owninguser); }
            set
            { AddLookupProperty(CrmStr.owninguser,CrmStr.systemuser,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public string parameterxml
        {
            get
            { return StringPropertyValue(CrmStr.parameterxml); }
            set
            { AddStringProperty(CrmStr.parameterxml,value); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public int templatetypecode
        {
            get
            { return PicklistPropertyIntValue(CrmStr.templatetypecode); }
            set
            { AddPicklistProperty(CrmStr.templatetypecode,value); }
        }

        public string templatetypecodeLabel
        {
            get
            { return PicklistPropertyLabelValue(CrmStr.templatetypecode); }
        }

        [CrmDynAttribute(CrmStr.mailmergetemplate)]
        public int timezoneruleversionnumber
        {
            get
            { return NumberPropertyValue(CrmStr.timezoneruleversionnumber); }
            set
            { AddNumberProperty(CrmStr.timezoneruleversionnumber,value); }
        }
    }
}